package com.coderly.onlinegallerysharingplatform.common.convention.exception;

import com.coderly.onlinegallerysharingplatform.common.convention.errorcode.ErrorCode;
import lombok.Getter;

/**
 * 自定义业务异常类
 */
@Getter
public class BizException extends RuntimeException{

    /**
     * 错误码
     */
    private final int errorCode;

    public BizException(int errorCode, String message) {
        super(message);
        this.errorCode = errorCode;
    }

    public BizException(ErrorCode errorCode) {
        super(errorCode.getMessage());
        this.errorCode = errorCode.getCode();
    }

    public BizException(ErrorCode errorCode, String message) {
        super(message);
        this.errorCode = errorCode.getCode();
    }


}
